package com.shlh.saas.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shlh.saas.entity.CustomerService;
import com.shlh.saas.mapper.CustomerServiceMapper;
import com.shlh.saas.service.CustomerServiceService;
import org.springframework.stereotype.Service;

/**
 * 客服信息服务实现类
 */
@Service
public class CustomerServiceServiceImpl extends ServiceImpl<CustomerServiceMapper, CustomerService> implements CustomerServiceService {

    /**
     * 获取客服信息
     * 默认返回第一条记录，如果没有记录则返回null
     * @return 客服信息对象
     */
    @Override
    public CustomerService getCustomerServiceInfo() {
        LambdaQueryWrapper<CustomerService> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(CustomerService::getId).last("LIMIT 1");
        return this.getOne(queryWrapper);
    }
} 